package com.zhlab.mybatisdemo.chapter2;

import com.zhlab.mybatisdemo.web.entity.SysAdminUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/")
public class MainController {

    @Autowired
    private SysAdminUserMapper sysAdminUserMapper;

    @RequestMapping("/list")
    public Object list() {
        SysAdminUser userParam = new SysAdminUser();
        userParam.setDeptId(5);
        List<SysAdminUser> userList = sysAdminUserMapper.getUserList(userParam);
        for (SysAdminUser user : userList) {
            System.out.println("name : " + user.getNickName() + " ;  email : " + user.getEmail());
        }
        return userList;
    }
}
